/**
 * Created by baidm in 2022/4/27 on 10:00
 */
import * as echarts from 'echarts';

export default function () {

    // 初始化图表公共方法
    const initChart = (elementId, option) => {
        let chartDom = document.getElementById(elementId);
        let myChart = echarts.init(chartDom);
        myChart.setOption(option);
        window.onresize = () => {
            myChart.resize()
        }
        return myChart
    }

    return {
        initChart
    }
}
